Chapter 4 - Processor Fundamentals

4.1 Central Processing Unit (CPU) Architecture

Stored Program Concept →

CPU Architecture →

Factors affecting CPU performance →

Computer Ports →

Fetch-Decode-Execute Cycle →

Register transfer notation →

MAR ← [PC]
PC ← [PC] + 1
MDR ← [[MAR]]
CIR ← [MDR]

(one bracket = value in register. double bracket = data at address in register)

Interrupts →

An interrupt is a signal from device requiring processor attention, such as:

How an interrupt is dealt with →

4.2 Assembly language

Machine Code & Assembly Language →

Modes of Addressing →

Immediate The value used is in the instruction. This is the fastest as no memory involved
Direct The operand holds value in instruction
Indirect The operand holds the address containing value used in instruction
Indexed The target address is the base address + value in index register
Relative The operand is offset from the current address where the value is stored

Instruction groups →

Data Movement Loads data into a register and stores in memory LDM, LDR, LDD, LDI, LDX, STO
Arithmetic Operations Mathematical functions ADD, INC, DEC
Comparisons & Jumps A program might need unconditional jump, or might need to jump depending on a condition. CMP usually followed by a jump JMP, CMP, JPE, JPN
Input & Output Allows entry of data or display of data IN, OUT
Ending Return control to operating system END

Instruction groups →

Data Movement Loads data into a register and stores in memory LDM, LDR, LDD, LDI, LDX, STO
Arithmetic Operations Mathematical functions ADD, INC, DEC
Comparisons & Jumps A program might need unconditional jump, or might need to jump depending on a condition. CMP usually followed by a jump JMP, CMP, JPE, JPN
Input & Output Allows entry of data or display of data IN, OUT
Ending Return control to operating system END

Special Features of Assembly Language →

Assemblers →

One-pass assembler: Goes through the program one line at a time and only refers to opcode table
Two-pass assembler: used for symbolic addressing

First pass Second pass
  • Remove comments
  • Create symbol table with binary codes for symbolic names and labels
  • Create literal table for constants
  • Identify system calls and subroutines
  • Act upon directives
  • Add symbolic adddress to table
  • Expand macros
  • Convert data items to binary
  • Replace symbolic addresses with absolute addresses
  • Resolve forward references
  • Create object code

Creating a symbol table →

4.3 Bitwise manipulation

Bitwise manipulation →

Bitwise operations are fast and simple opweations performed by CPU, treating each binary digit individually.

Bit masking →

A mask is a number used with logical operators AND, OR, XOR to identify, remove or set a single bit or group of bits in an address or registers.

Instruction Explanation
Opcode Operand
AND #n/Bn/&n Bitwise AND operation of the contents of ACC with the operand
AND [address] Bitwise AND operation of the contents of ACC with the contents of [address]
XOR #n/Bn/&n Bitwise XOR operation of the contents of ACC with the operand
XOR [address] Bitwise XOR operation of the contents of ACC with the contents of [address]
OR #n/Bn/&n Bitwise OR operation of the contents of ACC with the operand
OR [address] Bitwise OR operation of the contents of ACC with the contents of [address]
LSL #n Bits in ACC are shifted logically n places to the left. Zeros are introduced on the right hand end
LSR #n Bits in ACC are shifted logically n places to the right. Zeros are introduced on the left hand end